FROM sonatype/nexus3:3.34.1

ENV CROWD_ENABLED=false
ENV CROWD_URL=http://crawd:8095/crawd/
ENV CROWD_NAME=crawd
ENV CROWD_PASSWORD=crawd
ENV CROWD_CACHE=false

USER root

# Install crowd plugin
COPY --chown=nexus:nexus nexus3-crowd-plugin-3.8.2.jar /opt/sonatype/nexus/system/nexus3-crowd-plugin.jar
RUN echo "reference\:file\:nexus3-crowd-plugin.jar = 200" >> /opt/sonatype/nexus/etc/karaf/startup.properties

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]


# setup permissions
RUN chown nexus:nexus -R /opt/sonatype/nexus

USER nexus

CMD ["/opt/sonatype/start-nexus-repository-manager.sh"]

